<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="${s.base}/mobile/SRCFILE/css/styles.css" rel="stylesheet" type="text/css"/>
<link href="${s.base}/mobile/SRCFILE/css/weui.min.css" rel="stylesheet" type="text/css"/>
 <link href="${s.base}/mobile/SRCFILE/css/style4.css" rel="stylesheet">
     <link rel="stylesheet" href="${s.base}/mobile/css/font-awesome.min.css">
    <link rel="stylesheet" href="${s.base}/mobile/css/app.css">
    <link rel="stylesheet" href="${s.base}/mobile/css/style.css">
<script type="text/javascript" src="${s.base}/mobile/SRCFILE/js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="${s.base}/mobile/SRCFILE/js/jquery.cookie.js"></script>
<script>
$(document).ready(function(){
	//再次判断cookie中的值是否存在
	var deviceId ="755765971";
    if(deviceId){
        //根据设备ID去查询相应表的数据
    	selectDatas(deviceId);
    
    }else{
        alert("请重新输入设备ID");
    	window.location.href="./index.html";
    }
	$("#quit").click(function(){
		$.cookie('deviceId_cookie','');
        window.location.href="./index.html";
   });
	$(document).ready(function(){
			//设置所在城市
			$("#now_city").click(function(){
			window.location.href="./setCity.html";
		});
	});
	var myDate = new Date();
	var month=myDate.getMonth();//month从0-11代表1月到12月
	if(month==11||month==0||month==1){
		$("#bg_jpg").attr('src',"${s.base}/mobile/SRCFILE/jpg/dong.jpg"); 
	}else if(month==2||month==3||month==4){
		$("#bg_jpg").attr('src',"${s.base}/mobile/SRCFILE/jpg/chun.jpg"); 
	}else if(month==5||month==6||month==7){
		$("#bg_jpg").attr('src',"${s.base}/mobile/SRCFILE/jpg/xia.jpg"); 
	}else if(month==8||month==9||month==10){
		$("#bg_jpg").attr('src',"${s.base}/mobile/SRCFILE/jpg/qiu.jpg"); 
	}
});
//室内空气优良指示
var valueArea = [[-999, '优', '#00E400'], [50, '良', '#FFFF00'], [100, '轻度污染', '#FF7E00'], [150, '中度污染', '#FF0000'], [200, '重度污染', '#99004C'], [300, '严重污染', '#7E0023'], [500, '爆表', '#000000']];
var setAQI = function () {
    var aqi= $("#AQI").text();
    for (var i = valueArea.length-1; i >= 0; i--) {
        var vv=valueArea[i];
        if(aqi>vv[0]){
            $("#aqitext").text(vv[1]);
            $("#aqitext").css('color',vv[2]);
            $("#AQI").css('color',vv[2]);
            $("#aqispan").css('background-color',vv[2]);
            $(".date_pic").css('background-color',vv[2]);
            break;
        }
    }
};
function selectDatas(deviceId){
	$.ajax({
		type:"POST",
		url:"selectDatas.action",
		dataType:'json',
        data:({"deviceId":deviceId}),        
        success: function(data){
        	if(data.dataVo==null){
            	alert("查询出错，请重新输入设备ID");
            	window.location.href="./index.html";
        	}else{
        		$("#PMtwo").text(data.dataVo.pm2_5);
        		$("#HOCO").text(data.dataVo.hcho);
                $("#CO2").text(data.dataVo.co2);
                $("#PM10").text(data.dataVo.pm10);
                $("#PM1").text(data.dataVo.pm1_0);
                $("#T1").text(data.dataVo.temr);
                $("#H1").text(data.dataVo.him);
                $("#AQI").text(Math.floor(data.dataVo.aqi));
                $("#datetime").text(data.dataVo.time.substring(0,19));
            	setAQI();
        	}
        }
	});
}
function trend(num_type){
	var userkey_c = $.cookie('deviceId_cookie');
	var time = 'd';
	var type = 'stats';
    window.location.href="./dataLine.html?id="+userkey_c+"&num="+num_type+"&time="+time+"&type="+type+'&wxId=${wxId}';
}
/**var deviceId = $.cookie('deviceId_cookie');
if(deviceId){
	setInterval("selectDatas(deviceId)", 60000);
}**/
setInterval("window.location.reload()", 60000);

</script>
<style>
    .WeChat-bg img{ width: 1903px;}
    @media screen and (max-width: 1500px) {
    .WeChat-bg img{width: 100%;}
</style>

<title>空气净化系统</title>
</head>
<body>
<header class="dis-box header-menu" style="position: fixed;width: 100%;top: 0px;z-index: 999;">
            <a class="" href="javascript:history.go(-1)">
                <i class="iconfont icon-jiantou icon-write" style="color: white;"></i>
            </a>
            <h3 class="box-flex"></h3>
                                    <div class="user-right-box" id="now_city" style="margin-top: 1.5rem;margin-right: 1.5rem;">
                                        <p class="my-user-right-cont"><span class="my-t-remark color-whie" style="line-height: 30px;font-size: 26px;">芜湖</span></p>
                                    </div>
           
        </header>
<div id="web_bg" style="position:absolute; width:100%; height:100%; z-index:-1"> 
<img style="position:fixed;" id="bg_jpg" src="" height="100%" width="100%" /> 
</div>
<div id="main" class="panel">
    <!------------------首页内容--------------->
    <div id="index">

        <!------------------设置按钮--------------->

            <div class="basics_date">

                <span>PM2.5 ug/m³</span>
                <p onclick="trend(2)" id="PMtwo" num="2">0</p>
                <span id="cityAQI" style="font-size:16px;"></span>
            </div>
           <!--  <div class="decorate"><img src="${s.base}/mobile/SRCFILE/jpg/decorate.jpg"></div> -->

            <div class="numerical_value">
              <div onclick="trend(3)" class="air" id="show" num="3" style="display: block;">
                    <div class="title" style="text-align:center;width:90px;"><p></p><span id="aqitext"></span></div>
                    <div class="cont">
                        <div class="date_con">当前室内雾霾指数<span id="AQI"></span></div>
                        <div class="date_pic"><span id="aqispan"></span></div>

                    </div>
                </div>
              <!--   <div class="air" num="3">

                    <div class="title" style="text-align:center;width:90px;"><p></p><span id="outaqitext" style="color: rgb(126, 0, 35);">严重污染</span></div>
                    <div class="cont">
                        <div class="date_con"><span id="out_city" style="position: relative">西安  当前室外空气质量指数</span><span id="OUT_AQI" style="color: rgb(126, 0, 35);">312</span></div>
                        <div class="date_pics" style="background-color: rgb(126, 0, 35);"><span id="outaqispan" style="width: 0%; background-color: rgb(126, 0, 35);"></span></div>
                    </div>
                </div> -->
                <div class="temperature_humidity">
                    <ul>
                            <li onclick="trend(4)"><img src="${s.base}/mobile/SRCFILE/jpg/i4.png"><p>甲醛<br><span id="HOCO" num="4">NaN</span>mg/m³</p></li>
                            <li onclick="trend(5)"><img src="${s.base}/mobile/SRCFILE/jpg/i5.png"><p>CO2<br><span id="CO2" num="5"></span>ppm</p></li>

                        <div class="clear"></div>
                    </ul>
                </div>
                <div class="temperature_humidity">
                    <ul>
                        <li onclick="trend(6)"><img src="${s.base}/mobile/SRCFILE/jpg/i10.png"><p>PM10<br><span id="PM10"></span>ug/m³</p></li>
                        <li onclick="trend(7)"><img src="${s.base}/mobile/SRCFILE/jpg/i9.png"><p>PM1<br><span id="PM1"></span>ug/m³</p></li>

                        <div class="clear"></div>
                    </ul>
                </div>
                <div class="temperature_humidity">
                    <ul>
                        <li onclick="trend(8)"><img src="${s.base}/mobile/SRCFILE/jpg/i0.png"><p>温度<br><span id="T1"></span>℃</p></li>
                        <li onclick="trend(1)"><img src="${s.base}/mobile/SRCFILE/jpg/i1.png"><p>湿度<br><span id="H1" num="1"></span>%</p></li>
                        <div class="clear"></div>
                    </ul>
                </div>
                <br>
                <div class="update_time">
                    <p style="color:#ffffff">更新时间：<span id="datetime"></span></p>
                </div>
            </div>

    </div>
</div>
<!--js分享代码开始-->
<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
<input type="hidden" value="${jSTicketShareResponse.appid}" id="appid" />
<input type="hidden" value="${jSTicketShareResponse.fxTitle}" id="fxTitle" />
<input type="hidden" value="${jSTicketShareResponse.fxImgUrl}" id="fxImgUrl" />
<input type="hidden" value="${jSTicketShareResponse.fxDesc}" id="fxDesc" />
<input type="hidden" value="${jSTicketShareResponse.fxUrl}" id="fxUrl" />
<input type="hidden" value="${jSTicketShareResponse.nonceStr}" id="nonceStr" />
<input type="hidden" value="${jSTicketShareResponse.timestamp}" id="timestamp" />
<input type="hidden" value="${jSTicketShareResponse.signature}" id="signature" />
<script src="${s.base}/mobile/js/share.js"></script>
<!--js分享代码结束-->
</body>
</html>